// src/composables/useSystemInfo.js
import { ref, onMounted } from 'vue';

export function useSystemInfo() {
  const safeAreaInsets = ref(null);
  const headerHeight = ref(88); // 默认导航栏高度

  onMounted(() => {
    const info = uni.getSystemInfoSync();
    safeAreaInsets.value = info.safeAreaInsets;
    // #ifdef MP-WEIXIN
    const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
    headerHeight.value = menuButtonInfo.bottom + menuButtonInfo.top - info.statusBarHeight;
    // #endif
  });

  return {
    safeAreaInsets,
    headerHeight,
  };
}